%%DocumentFonts: Helvetica %%DocumentNeededFonts: Helvetica %%IncludeFont: Helvetica /RE { findfont begin currentdict dup length dict begin { 1 index /FID ne {def}{pop pop}ifelse }forall /FontName exch def dup length 0 ne { /Encoding Encoding 256 array copy def 0 exch { dup type /nametype eq { Encoding 2 index 2 index put pop 1 add } { exch pop }ifelse }forall }if pop currentdict dup end end /FontName get exch definefont pop } bind def /stdencoding [ 39/quotesingle 96/grave 128/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis /Udieresis/aacute/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute /egrave/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde /oacute/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex /udieresis/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls /registered/copyright/trademark/acute/dieresis/.notdef/AE/Oslash /.notdef/plusminus/.notdef/.notdef/yen/mu/.notdef/.notdef /.notdef/.notdef/.notdef/ordfeminine/ordmasculine/.notdef/ae/oslash /questiondown/exclamdown/logicalnot/.notdef/florin/.notdef/.notdef /guillemotleft/guillemotright/ellipsis/.notdef/Agrave/Atilde/Otilde/OE/oe /endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide /.notdef/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright /fi/fl/daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand /Acircumflex/Ecircumflex/Aacute/Edieresis/Egrave/Iacute/Icircumflex /Idieresis/Igrave/Oacute/Ocircumflex/.notdef/Ograve/Uacute/Ucircumflex /Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla /hungarumlaut/ogonek/caron ] def stdencoding /_Helvetica /Helvetica RE stdencoding /_Helvetica-Oblique /Helvetica-Oblique RE stdencoding /_Helvetica-Bold /Helvetica-Bold RE stdencoding /_Helvetica-BoldOblique /Helvetica-BoldOblique RE /Monaco10 /_Helvetica findfont 10 scalefont def /MonacoI10 /_Helvetica-Oblique findfont 10 scalefont def /MonacoB10 /_Helvetica-Bold findfont 10 scalefont def /MonacoBI10 /_Helvetica-BoldOblique findfont 10 scalefont def /Monaco9 /_Helvetica findfont 9 scalefont def /MonacoI9 /_Helvetica-Oblique findfont 9 scalefont def /defaultHeight 30 def /ifDefaultHeight 40 def /defaultWidth 60 def /pointSize 3 def /diamondWidth 8 def /pyramidWidth 18 def /eventBoxWidth 9 def /drawClassBox % oper1 ... opern noOfOpers attr1 ... attrn noOfAttrs name abstract nested { 50 dict begin /nested exch def /abstract exch def /name exch def false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse /maxwidth name stringwidth pop def /boxwidth defaultWidth def /noOfAttr exch def /AttrArray noOfAttr array def /index noOfAttr 1 sub def { index -1 eq { exit } if AttrArray index 3 -1 roll put /index index 1 sub def } loop /noOfOper exch def /OperArray noOfOper array def /index noOfOper 1 sub def { index -1 eq { exit } if OperArray index 3 -1 roll put /index index 1 sub def } loop % Set font size for attributes an operations while checking boxwidth false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse /leftmargin currentpoint pop def /topmargin currentpoint exch pop def AttrArray { stringwidth pop 8 add dup maxwidth gt { /maxwidth exch def }{ pop } ifelse } forall OperArray { stringwidth pop 8 add dup maxwidth gt { /maxwidth exch def }{ pop } ifelse } forall % Set back font size for the class name false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if noOfAttr 0 ne { /boxheight noOfAttr 12 mul 26 add def } if noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def } { /boxheight noOfOper 12 mul 26 add def } ifelse } if noOfOper 0 eq { noOfAttr 0 eq { /boxheight defaultHeight def } if } if boxheight defaultHeight lt { /boxheight defaultHeight def } if nested true eq { [3] 0 setdash } if currentpoint boxwidth 0 rlineto 0 boxheight neg rlineto boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke nested true eq { [] 0 setdash } if noOfAttr 0 ne { leftmargin topmargin -18 add moveto boxwidth 0 rlineto stroke } if noOfOper 0 ne { newpath noOfAttr 0 ne { leftmargin topmargin -24 add noOfAttr -12 mul add moveto } { leftmargin topmargin -20 add moveto }ifelse boxwidth 0 rlineto stroke }if moveto currentpoint boxwidth name stringwidth pop sub 2 div -14 rmoveto name show false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse currentpoint /index 0 def AttrArray { leftmargin 8 add topmargin moveto 0 -12 index mul -30 add rmoveto show /index index 1 add def } forall moveto currentpoint /index 0 def OperArray { leftmargin 8 add topmargin moveto noOfAttr 0 ne { 0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto } { 0 -12 index mul 32 sub rmoveto }ifelse show /index index 1 add def } forall leftmargin boxwidth add topmargin boxheight sub end } def /drawInterfaceBox % oper1 ... opern noOfOpers attr1 ... attrn noOfAttrs name drawInterfaceBox { 50 dict begin /name exch def MonacoB10 setfont /maxwidth name stringwidth pop def /boxwidth defaultWidth def /noOfAttr exch def /AttrArray noOfAttr array def /index noOfAttr 1 sub def { index -1 eq { exit } if AttrArray index 3 -1 roll put /index index 1 sub def } loop /noOfOper exch def /OperArray noOfOper array def /index noOfOper 1 sub def { index -1 eq { exit } if OperArray index 3 -1 roll put /index index 1 sub def } loop % Set font size for attributes an operations while checking boxwidth Monaco9 setfont /leftmargin currentpoint pop def /topmargin currentpoint exch pop def AttrArray { stringwidth pop 8 add dup maxwidth gt { /maxwidth exch def }{ pop } ifelse } forall OperArray { stringwidth pop 8 add dup maxwidth gt { /maxwidth exch def }{ pop } ifelse } forall MonacoB10 setfont maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if noOfAttr 0 ne { /boxheight noOfAttr 12 mul 36 add def } if noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def } { /boxheight noOfOper 12 mul 36 add def } ifelse } if noOfOper 0 eq { noOfAttr 0 eq { /boxheight ifDefaultHeight def } if } if boxheight ifDefaultHeight lt { /boxheight ifDefaultHeight def } if currentpoint boxwidth 0 rlineto 0 boxheight neg rlineto boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke noOfAttr 0 ne { leftmargin topmargin -28 add moveto boxwidth 0 rlineto stroke } if noOfOper 0 ne { newpath noOfAttr 0 ne { leftmargin topmargin -34 add noOfAttr -12 mul add moveto } { leftmargin topmargin -28 add moveto }ifelse boxwidth 0 rlineto stroke }if moveto currentpoint boxwidth name stringwidth pop sub 2 div -24 rmoveto name show leftmargin topmargin moveto boxwidth («interface») stringwidth pop sub 2 div -14 rmoveto («interface») show Monaco9 setfont currentpoint /index 0 def AttrArray { leftmargin 8 add topmargin 10 sub moveto 0 -12 index mul -30 add rmoveto show /index index 1 add def } forall moveto currentpoint /index 0 def OperArray { leftmargin 8 add topmargin 10 sub moveto noOfAttr 0 ne { 0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto } { 0 -12 index mul 32 sub rmoveto }ifelse show /index index 1 add def } forall leftmargin boxwidth add topmargin boxheight sub end } def /drawAssoc % pointn ... point1 noOfPoints branchRole branchMultText branchMult branchQualPos branchQual baseRole baseMultText baseMult baseQualPos baseQual name { 50 dict begin Monaco9 setfont /name exch def /baseQual exch def /baseQualPos exch def /baseMult exch def /baseMultText exch def /baseRole exch def /branchQual exch def /branchQualPos exch def /branchMult exch def /branchMultText exch def /branchRole exch def /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def { index noOfPoints 2 mul eq { exit } if pntArray index 3 -1 roll put /index index 1 add def } loop % Get the base qualifier's position /baseQualTW baseQual stringwidth pop def /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def /p1.v pntArray noOfPoints 1 sub 2 mul get def /connect.h p1.h def /connect.v p1.v def baseQualPos 1 eq { % to the left of the first point baseMult 1 eq { /connect.h connect.h pointSize 2 div 2 add add def } if baseMult 2 eq { /connect.h connect.h pointSize 2 div 2 add add def } if } if baseQualPos 2 eq { % above the first point baseMult 1 eq { /connect.v connect.v pointSize 2 div 2 add sub def } if baseMult 2 eq { /connect.v connect.v pointSize 2 div 2 add sub def } if } if baseQualPos 3 eq { % to the right of the first point baseMult 1 eq { /connect.h connect.h pointSize 2 div 2 add sub def } if baseMult 2 eq { /connect.h connect.h pointSize 2 div 2 add sub def } if } if baseQualPos 4 eq { % below the first point baseMult 1 eq { /connect.v connect.v pointSize 2 div 2 add add def } if baseMult 2 eq { /connect.v connect.v pointSize 2 div 2 add add def } if } if baseQualPos 1 eq { % to the left of the first point /p1.h connect.h baseQualTW 5 add sub def /p1.v connect.v 3 sub def } if baseQualPos 2 eq { % above the first point /p1.h connect.h baseQualTW 2 div sub def /p1.v connect.v 4 add def } if baseQualPos 3 eq { % to the right of the first point /p1.h connect.h 6 add def /p1.v connect.v 3 sub def } if baseQualPos 4 eq { % below the first point /p1.h connect.h baseQualTW 2 div sub def /p1.v connect.v 10 sub def } if /baseQualText.h p1.h def /baseQualText.v p1.v def /lineConnect.h connect.h def /lineConnect.v connect.v def % Determine the qualifiers rectangle size baseQualTW 0 ne { baseQualPos 1 eq { % to the left of the first class /RectRight connect.h def /RectLeft baseQualText.h 5 sub def /lineConnect.h RectLeft def /RectTop baseQualText.v 12 add def /RectBottom RectTop 16 sub def } if baseQualPos 3 eq { % to the right of the first class /RectLeft connect.h def /RectRight baseQualText.h baseQualTW 5 add add def /lineConnect.h RectRight def /RectTop baseQualText.v 12 add def /RectBottom RectTop 16 sub def } if baseQualPos 2 eq { % above the first point /RectBottom connect.v def /RectTop RectBottom 16 add def /lineConnect.v RectTop def /RectLeft baseQualText.h 4 sub def /RectRight RectLeft baseQualTW 9 add add def } if baseQualPos 4 eq { % below the first point /RectTop connect.v def /RectBottom RectTop 16 sub def /lineConnect.v RectBottom def /RectLeft baseQualText.h 4 sub def /RectRight RectLeft baseQualTW add 9 add def } if RectLeft RectTop moveto RectRight RectTop lineto RectRight RectBottom lineto RectLeft RectBottom lineto closepath stroke newpath baseQualText.h baseQualText.v moveto baseQual show } if newpath 1 setlinewidth 0 setgray /index 0 def { index noOfPoints eq { exit } if pntArray index 2 mul 1 add get pntArray index 2 mul get index noOfPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop stroke /circle.h pntArray noOfPoints 1 sub 2 mul 1 add get def /circle.v pntArray noOfPoints 1 sub 2 mul get def baseQualTW 0 ne { baseQualPos 1 eq { % to the left of the first class /circle.h circle.h baseQualTW 9 add sub def } if baseQualPos 3 eq { % to the right of the first class /circle.h circle.h baseQualTW 11 add add def } if baseQualPos 2 eq { % above the first point /circle.v circle.v 16 add def } if baseQualPos 4 eq { % below the first point /circle.v circle.v 16 sub def } if } if circle.h circle.v baseMult 1 eq { % hollow circle pointSize 0.5 sub 0 360 arc stroke circle.h circle.v pointSize 1 sub 0 360 arc 1 setgray fill } if baseMult 2 eq { % filled circle pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill } if 0 setgray /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def /p1.v pntArray noOfPoints 1 sub 2 mul get def /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def /p2.v pntArray noOfPoints 2 sub 2 mul get def /roletextwidth baseRole stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h roletextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 10 sub } { p1.h 6 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 10 sub } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if } { p1.h 6 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if } { p1.h 6 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto baseRole show /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def /p1.v pntArray noOfPoints 1 sub 2 mul get def /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def /p2.v pntArray noOfPoints 2 sub 2 mul get def /multtextwidth baseMultText stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if } { p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h multtextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 4 add } { p1.h 5 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 4 add } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if } { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto baseMult 3 eq { baseMultText show } if newpath % Get the branch qualifier's position /branchQualTW branchQual stringwidth pop def /p1.h pntArray 1 get def /p1.v pntArray 0 get def /connect.h p1.h def /connect.v p1.v def branchQualPos 1 eq { % to the left of the first point branchMult 1 eq { /connect.h connect.h pointSize 2 div 2 add add def } if branchMult 2 eq { /connect.h connect.h pointSize 2 div 2 add add def } if /p1.h connect.h branchQualTW 5 add sub def /p1.v connect.v 3 sub def } if branchQualPos 2 eq { % above the first point branchMult 1 eq { /connect.v connect.v pointSize 2 div 2 add sub def } if branchMult 2 eq { /connect.v connect.v pointSize 2 div 2 add sub def } if /p1.h connect.h branchQualTW 2 div sub def /p1.v connect.v 4 add def } if branchQualPos 3 eq { % to the right of the first point branchMult 1 eq { /connect.h connect.h pointSize 2 div 2 add sub def } if branchMult 2 eq { /connect.h connect.h pointSize 2 div 2 add sub def } if /p1.h connect.h 6 add def /p1.v connect.v 3 sub def } if branchQualPos 4 eq { % below the first point branchMult 1 eq { /connect.v connect.v pointSize 2 div 2 add add def } if branchMult 2 eq { /connect.v connect.v pointSize 2 div 2 add add def } if /p1.h connect.h branchQualTW 2 div sub def /p1.v connect.v 10 sub def } if /branchQualText.h p1.h def /branchQualText.v p1.v def /lineConnect.h connect.h def /lineConnect.v connect.v def % Determine the qualifiers rectangle size branchQualTW 0 ne { branchQualPos 1 eq { % to the left of the first class /RectRight connect.h def /RectLeft branchQualText.h 5 sub def /lineConnect.h RectLeft def /RectTop branchQualText.v 12 add def /RectBottom RectTop 16 sub def } if branchQualPos 3 eq { % to the right of the first class /RectLeft connect.h def /RectRight branchQualText.h branchQualTW 5 add add def /lineConnect.h RectRight def /RectTop branchQualText.v 12 add def /RectBottom RectTop 16 sub def } if branchQualPos 2 eq { % above the first point /RectBottom connect.v def /RectTop RectBottom 16 add def /lineConnect.v RectTop def /RectLeft branchQualText.h 4 sub def /RectRight RectLeft branchQualTW 9 add add def } if branchQualPos 4 eq { % below the first point /RectTop connect.v def /RectBottom RectTop 16 sub def /lineConnect.v RectBottom def /RectLeft branchQualText.h 4 sub def /RectRight RectLeft branchQualTW add 9 add def } if RectLeft RectTop moveto RectRight RectTop lineto RectRight RectBottom lineto RectLeft RectBottom lineto closepath gsave 1 setgray fill grestore stroke newpath branchQualText.h branchQualText.v moveto branchQual show } if newpath 0 setgray /circle.h pntArray 1 get def /circle.v pntArray 0 get def branchQualTW 0 ne { branchQualPos 1 eq { % to the left of the first class /circle.h circle.h branchQualTW 9 add sub def } if branchQualPos 3 eq { % to the right of the first class /circle.h circle.h branchQualTW 11 add add def } if branchQualPos 2 eq { % above the first point /circle.v circle.v 16 add def } if branchQualPos 4 eq { % below the first point /circle.v circle.v 16 sub def } if } if circle.h circle.v branchMult 1 eq { % hollow circle pointSize 0.5 sub 0 360 arc stroke circle.h circle.v pointSize 1 sub 0 360 arc 1 setgray fill } if branchMult 2 eq { % filled circle pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill } if 0 setgray /p1.h pntArray 1 get def /p1.v pntArray 0 get def /p2.h pntArray 3 get def /p2.v pntArray 2 get def /roletextwidth branchRole stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h roletextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v 10 sub } { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 10 sub } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h roletextwidth 5 add add p1.v 0 sub branchQualTW 0 ne { 14 sub } if } { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto branchRole show /p1.h pntArray 1 get def /p1.v pntArray 0 get def /p2.h pntArray 3 get def /p2.v pntArray 2 get def /multtextwidth branchMultText stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if } { p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h multtextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v 4 add } { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 4 add } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if } { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto branchMult 3 eq { branchMultText show }if end } def /drawAggr % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult ] noOfBranches pointn ... point1 noOfPoints baseRole baseMultText baseMult qualPos qualifier name byvalue diamondx diamondy { 70 dict begin Monaco9 setfont /diay exch def /diax exch def /byvalue exch def /name exch def /qualifier exch def /qualPos exch def /baseMult exch def /baseMultText exch def /baseRole exch def /noOfStemPoints exch def /stemArray noOfStemPoints 2 mul array def /index 0 def { index noOfStemPoints 2 mul eq { exit } if stemArray index 3 -1 roll put /index index 1 add def } loop % Get the qualifier's position /qualTW qualifier stringwidth pop def /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def /p1.v stemArray noOfStemPoints 1 sub 2 mul get def /connect.h p1.h def /connect.v p1.v def qualPos 1 eq { % to the left of the first point /connect.h connect.h diamondWidth 0.5 add add def /p1.h connect.h qualTW 5 add sub def /p1.v connect.v 3 sub def } if qualPos 2 eq { % above the first point /connect.v connect.v diamondWidth 1 add sub def /p1.h connect.h qualTW 2 div sub def /p1.v connect.v 4 add def } if qualPos 3 eq { % to the right of the first point /connect.h connect.h diamondWidth sub def /p1.h connect.h 6 add def /p1.v connect.v 3 sub def } if qualPos 4 eq { % below the first point /connect.v connect.v diamondWidth 0.5 add add def /p1.h connect.h qualTW 2 div sub def /p1.v connect.v 10 sub def } if /qualText.h p1.h def /qualText.v p1.v def /lineConnect.h connect.h def /lineConnect.v connect.v def % Determine the qualifiers rectangle size qualTW 0 ne { qualPos 1 eq { % to the left of the first class /RectRight connect.h def /RectLeft qualText.h 5 sub def /lineConnect.h RectLeft def /RectTop qualText.v 12 add def /RectBottom RectTop 16 sub def } if qualPos 3 eq { % to the right of the first class /RectLeft connect.h def /RectRight qualText.h qualTW 5 add add def /lineConnect.h RectRight def /RectTop qualText.v 12 add def /RectBottom RectTop 16 sub def } if qualPos 2 eq { % above the first point /RectBottom connect.v def /RectTop RectBottom 16 add def /lineConnect.v RectTop def /RectLeft qualText.h 4 sub def /RectRight RectLeft qualTW 9 add add def } if qualPos 4 eq { % below the first point /RectTop connect.v def /RectBottom RectTop 16 sub def /lineConnect.v RectBottom def /RectLeft qualText.h 4 sub def /RectRight RectLeft qualTW add 9 add def } if RectLeft RectTop moveto RectRight RectTop lineto RectRight RectBottom lineto RectLeft RectBottom lineto closepath stroke newpath qualText.h qualText.v moveto qualifier show } if /noOfBranches exch def /branchesArray noOfBranches array def /index 0 def { index noOfBranches eq { exit } if /branchMult exch def /branchMultText exch def /branchRole exch def /noOfBranchPoints exch def noOfBranchPoints 0 ne { /pntArray noOfBranchPoints 2 mul array def /pntIndex 0 def { pntIndex noOfBranchPoints 2 mul eq { exit } if pntArray pntIndex 3 -1 roll put /pntIndex pntIndex 1 add def } loop /branchArray 5 array def branchArray 0 branchMult put branchArray 1 branchMultText put branchArray 2 branchRole put branchArray 3 noOfBranchPoints put branchArray 4 pntArray put } { /branchArray 4 array def branchArray 0 branchMult put branchArray 1 branchMultText put branchArray 2 branchRole put branchArray 3 noOfBranchPoints put } ifelse branchesArray index branchArray put /index index 1 add def } loop newpath 1 setlinewidth 0 setgray /index 0 def { index noOfStemPoints eq { exit } if stemArray index 2 mul 1 add get stemArray index 2 mul get index noOfStemPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop branchesArray { /branch exch def /branchMult branch 0 get def /branchMultText branch 1 get def /noOfPoints branch 3 get def noOfPoints 0 ne { /pntArray branch 4 get def /index 0 def { index noOfPoints eq { exit } if pntArray index 2 mul 1 add get pntArray index 2 mul get index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop } if }forall stroke branchesArray { /branch exch def /branchMult branch 0 get def /branchMultText branch 1 get def /branchRole branch 2 get def /noOfPoints branch 3 get def noOfPoints 0 ne { /pntArray branch 4 get def newpath /p1.h pntArray 1 get def /p1.v pntArray 0 get def /p2.h pntArray 3 get def /p2.v pntArray 2 get def } { newpath /p1.h stemArray 1 get def /p1.v stemArray 0 get def /p2.h stemArray 3 get def /p2.v stemArray 2 get def } ifelse 0 setgray p1.h p1.v branchMult 1 eq { % hollow circle pointSize 0.5 sub 0 360 arc stroke p1.h p1.v pointSize 1 sub 0 360 arc 1 setgray fill } if branchMult 2 eq { % filled circle pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill } if 0 setgray /roletextwidth branchRole stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h 5 add p1.v 4 add }{ p1.h 5 add p1.v 10 sub } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse } { p1.h p2.h gt { p1.h roletextwidth 5 add add p1.v 0 sub } { p1.h 5 add p1.v 10 sub } ifelse } ifelse } ifelse } ifelse moveto branchRole show noOfPoints 0 ne { /pntArray branch 4 get def newpath /p1.h pntArray 1 get def /p1.v pntArray 0 get def /p2.h pntArray 3 get def /p2.v pntArray 2 get def } { newpath /p1.h stemArray 1 get def /p1.v stemArray 0 get def /p2.h stemArray 3 get def /p2.v stemArray 2 get def } ifelse /multtextwidth branchMultText stringwidth pop def 0 setgray p1.h p2.h eq { p1.v p2.v le { p1.h multtextwidth 5 add sub p1.v 4 add } { p1.h multtextwidth 5 add sub p1.v 10 sub } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse } { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse } ifelse } ifelse } ifelse moveto branchMult 3 eq { branchMultText show }if }forall stroke 0 setgray /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def /p1.v stemArray noOfStemPoints 1 sub 2 mul get def /p2.h stemArray noOfStemPoints 2 sub 2 mul 1 add get def /p2.v stemArray noOfStemPoints 2 sub 2 mul get def /roletextwidth baseRole stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h roletextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 10 sub } { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 10 sub } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if } { p1.h 6 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h roletextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if } { p1.h 6 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto baseRole show newpath p1.h p2.h eq { p1.v p2.v le { p1.h p1.v 3 add qualTW 0 ne { 15 add } if } { p1.h p1.v 3 sub qualTW 0 ne { 16 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h 2 sub qualTW 0 ne { qualTW 10 add sub } if p1.v } { p1.h 2 add qualTW 0 ne { qualTW 12 add add } if p1.v } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h pointSize 5 add sub p1.v 4 add qualTW 0 ne { 15 add } if } { p1.h 5 add p1.v 4 add qualTW 0 ne { 15 add } if } ifelse } { p1.h p2.h gt { p1.h pointSize 5 add sub p1.v 10 sub qualTW 0 ne { 15 sub } if } { p1.h 5 add p1.v 10 sub qualTW 0 ne { 15 sub } if } ifelse } ifelse } ifelse } ifelse /y exch def /x exch def x y baseMult 1 eq { % hollow circle pointSize 0.5 sub 0 360 arc stroke x y pointSize 1 sub 0 360 arc 1 setgray fill } if baseMult 2 eq { % filled circle pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill } if /multtextwidth baseMultText stringwidth pop def p1.h p2.h eq { p1.v p2.v le { p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 add } if } { p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 sub } if } ifelse } { p1.v p2.v eq { p1.h p2.h gt { p1.h multtextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 4 add } { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 4 add } ifelse } { p1.v p2.v le { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if } { p1.h 5 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse } { p1.h p2.h gt { p1.h multtextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if } { p1.h 5 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse } ifelse } ifelse } ifelse moveto baseMult 3 eq { baseMultText show } if newpath 1 setlinewidth qualTW 0 ne { qualPos 1 eq { /diax diax qualTW 9 add sub def } if qualPos 2 eq { /diay diay 16 add def } if qualPos 3 eq { /diax diax qualTW 11 add add def } if qualPos 4 eq { /diay diay 16 sub def } if } if diax diamondWidth 2 div sub 0.5 add diay moveto diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub rlineto diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub neg rlineto diamondWidth 2 div 1 sub neg diamondWidth 2 div 1 sub neg rlineto closepath byvalue 0 eq { 1 setgray }{ 0 setgray } ifelse fill newpath 1 setlinewidth 0 setgray diax diamondWidth 2 div sub diay moveto diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub rlineto diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub neg rlineto diamondWidth 2 div 0.5 sub neg diamondWidth 2 div 0.5 sub neg rlineto closepath stroke end } def /arrowdict 15 dict def arrowdict begin /mtrx matrix def end /drawArrow % tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawArrow { arrowdict begin /filled exch def /dashed exch def /headlength exch def /halfheadthickness exch 2 div def /halfthickness exch 2 div def /tipy exch def /tipx exch def /taily exch def /tailx exch def /dx tipx tailx sub def /dy tipy taily sub def /arrowlength dx dx mul dy dy mul add sqrt def /angle dy dx atan def /arrowlength arrowlength headlength add def /base arrowlength headlength sub def /savematrix mtrx currentmatrix def tailx taily translate angle rotate base halfthickness neg moveto base halfheadthickness neg lineto arrowlength 0 lineto base halfheadthickness lineto base halfthickness lineto closepath filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse savematrix setmatrix newpath 1 setlinewidth tailx taily translate angle rotate dashed true eq { [3] 0 setdash }if 0 0 moveto base 0 lineto stroke dashed true eq { [] 0 setdash }if savematrix setmatrix end } def /genarrowdict 15 dict def genarrowdict begin /mtrx matrix def end /drawGenArrow % tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawGenArrow { genarrowdict begin /filled exch def /dashed exch def /headlength exch def /halfheadthickness exch 2 div def /halfthickness exch 2 div def /tipy exch def /tipx exch def /taily exch def /tailx exch def /dx tipx tailx sub def /dy tipy taily sub def /arrowlength dx dx mul dy dy mul add sqrt halfthickness sub def /angle dy dx atan def /base arrowlength headlength sub def /savematrix mtrx currentmatrix def tailx taily translate angle rotate base halfthickness neg moveto base halfheadthickness neg lineto arrowlength 0 lineto base halfheadthickness lineto base halfthickness lineto closepath filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse savematrix setmatrix newpath 1 setlinewidth tailx taily translate angle rotate dashed true eq { [3] 0 setdash }if 0 0 moveto base 0 lineto stroke dashed true eq { [] 0 setdash }if savematrix setmatrix end } def % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult ] noOfBranches pointn ... point1 noOfPoints baseRole baseMultText baseMult qualPos qualifier name pyramidorientation pyramidx pyramidy omtNotation /drawGen { 50 dict begin Monaco9 setfont /omtNotation exch def /pyry exch def /pyrx exch def /orient exch def /name exch def /noOfStemPoints exch def /stemArray noOfStemPoints 2 mul array def /index 0 def { index noOfStemPoints 2 mul eq { exit } if stemArray index 3 -1 roll put /index index 1 add def } loop /noOfBranches exch def /branchesArray noOfBranches array def /index 0 def { index noOfBranches eq { exit } if /branchMult exch def /branchMultText exch def /branchRole exch def /noOfBranchPoints exch def noOfBranchPoints 0 ne { /pntArray noOfBranchPoints 2 mul array def /pntIndex 0 def { pntIndex noOfBranchPoints 2 mul eq { exit } if pntArray pntIndex 3 -1 roll put /pntIndex pntIndex 1 add def } loop /branchArray 2 array def branchArray 0 noOfBranchPoints put branchArray 1 pntArray put } { /branchArray 1 array def branchArray 0 noOfBranchPoints put } ifelse branchesArray index branchArray put /index index 1 add def } loop newpath 1 setlinewidth 0 setgray /index 0 def { index noOfStemPoints eq { exit } if stemArray index 2 mul 1 add get stemArray index 2 mul get index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop branchesArray { /branch exch def /noOfPoints branch 0 get def noOfPoints 0 ne { /pntArray branch 1 get def /index 0 def { index noOfPoints eq { exit } if pntArray index 2 mul 1 add get pntArray index 2 mul get index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop }if }forall stroke newpath pyrx pyry moveto omtNotation 1 eq { orient 0 eq { pyramidWidth 2 div 1.6 sub 0 rlineto pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto } if orient 2 eq { 0 pyramidWidth 2 div 1.6 sub rlineto pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto } if orient 4 eq { pyramidWidth 2 div 1.6 sub neg 0 rlineto pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto } if orient 6 eq { 0 pyramidWidth 2 div 1.6 sub neg rlineto pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto } if closepath 1 setgray fill newpath 1 setlinewidth 0 setgray pyrx pyry moveto orient 0 eq { pyramidWidth 2 div 0.5 sub 0 rlineto pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto } if orient 2 eq { 0 pyramidWidth 2 div 0.5 sub rlineto pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto } if orient 4 eq { pyramidWidth 2 div 0.5 sub neg 0 rlineto pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto } if orient 6 eq { 0 pyramidWidth 2 div 0.5 sub neg rlineto pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto } if closepath stroke } { /i noOfStemPoints 2 mul def stemArray i 3 sub get stemArray i 4 sub get stemArray i 1 sub get stemArray i 2 sub get 1 15 20 false false drawGenArrow } ifelse end } def /drawEventBox % ulc.x ulc.y height { 50 dict begin /height exch def /ulcy exch def /ulcx exch def newpath 1 setlinewidth ulcx ulcy moveto eventBoxWidth 0 rlineto 0 height neg rlineto eventBoxWidth neg 0 rlineto closepath gsave stroke grestore 1 setgray fill 0 setgray fill end } def /drawEventThread % ulc.x ulc.y height name { 50 dict begin /name exch def /height exch def /ulcy exch def /ulcx exch def newpath 1 setlinewidth Monaco10 setfont 1 setlinewidth ulcx ulcy moveto 0 height neg rlineto stroke ulcx name stringwidth pop 2 div sub ulcy 10 add moveto name show end } def /drawEventEvent % fulcx fulcy flrcx flrcy ulcx ulcy lrcx lrcy name dashed { 50 dict begin /dashed exch def /name exch def /lrcy exch def /lrcx exch def /ulcy exch def /ulcx exch def /flrcy exch def /flrcx exch def /fulcy exch def /fulcx exch def Monaco9 setfont newpath 1 setlinewidth ulcx ulcy lrcx lrcy 1 5 5 dashed true drawArrow fulcx flrcx gt { % above to the left of p1 /textx fulcx name stringwidth pop 3 add sub def /texty fulcy 2 add def } { % above to the right of p1 /textx fulcx 4 add def /texty fulcy 2 add def }ifelse textx texty moveto name show end } def /drawSupp % pointn ... point1 noOfPoints name drawSupp { 50 dict begin /name exch def /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def { index noOfPoints 2 mul eq { exit } if pntArray index 3 -1 roll put /index index 1 add def } loop Monaco9 setfont [3] 0 setdash newpath 1 setlinewidth noOfPoints 2 gt { /index 0 def { index noOfPoints 1 sub eq { exit } if /p1.h pntArray index 2 mul 1 add get def /p1.v pntArray index 2 mul get def /p2.h pntArray index 1 add 2 mul 1 add get def /p2.v pntArray index 1 add 2 mul get def p1.h p1.v moveto p2.h p2.v lineto stroke /index index 1 add def } loop } if /p1.h pntArray 1 get def /p1.v pntArray 0 get def /p2.h pntArray 3 get def /p2.v pntArray 2 get def p1.h p2.h eq { p1.v p2.v gt { /p1.v p1.v 5 sub def } { /p1.v p1.v 5 add def }ifelse } { p1.h p2.h gt { /p1.h p1.h 5 sub def } { /p1.h p1.h 5 add def }ifelse } ifelse [] 0 setdash p2.h p2.v p1.h p1.v 1 5 5 true true drawArrow end } def /fourpops { pop pop pop pop } def /drawRoundedBox % ulcx ulcy width height { 50 dict begin /height exch def /width exch def /ulcy exch def /ulcx exch def /lrcx ulcx width add def /lrcy ulcy height sub def ulcx lrcy 10 add moveto ulcx lrcy lrcx lrcy 5 arcto fourpops lrcx lrcy lrcx ulcy 5 arcto fourpops lrcx ulcy ulcx ulcy 5 arcto fourpops ulcx ulcy ulcx lrcy 5 arcto fourpops closepath gsave 1 setgray fill grestore stroke end } def /drawStateBox % actionn eventn .. action1 event1 noOfEvents exitlinen exitline1 noOfExitLines dolinen doline1 noOfDoLines entrylinen entryline1 noOfEntryLines name { 50 dict begin /boxheight 30 def /boxwidth 60 def /name exch def % % Get all the entry/ lines and store them in entryLineArray % /noOfEntryLines exch def /entryLineWidth 0 def /entryHeight 0 def noOfEntryLines 0 ne { /entryLineArray noOfEntryLines array def /entryLineIndex 0 def { entryLineIndex noOfEntryLines eq { exit } if entryLineArray entryLineIndex 3 -1 roll put /entryLineIndex entryLineIndex 1 add def } loop /entryHeight entryLineIndex 12 mul def /rubrikwidth MonacoI9 setfont (entry/ ) stringwidth pop def Monaco9 setfont entryLineArray { stringwidth pop dup rubrikwidth add 16 add entryLineWidth gt { /entryLineWidth exch def }{ pop } ifelse } forall } if % % Get all the do: lines and store them in doLineArray % /noOfDoLines exch def /doLineWidth 0 def /doHeight 0 def noOfDoLines 0 ne { /doLineArray noOfDoLines array def /doLineIndex 0 def { doLineIndex noOfDoLines eq { exit } if doLineArray doLineIndex 3 -1 roll put /doLineIndex doLineIndex 1 add def } loop /doHeight doLineIndex 12 mul def /rubrikwidth Monaco9 setfont (do: ) stringwidth pop def doLineArray { stringwidth pop dup rubrikwidth add 16 add doLineWidth gt { /doLineWidth exch def }{ pop } ifelse } forall } if % % Get all the exit/ lines and store them in exitLineArray % /noOfExitLines exch def /exitLineWidth 0 def /exitHeight 0 def noOfExitLines 0 ne { /exitLineArray noOfExitLines array def /exitLineIndex 0 def { exitLineIndex noOfExitLines eq { exit } if exitLineArray exitLineIndex 3 -1 roll put /exitLineIndex exitLineIndex 1 add def } loop /exitHeight exitLineIndex 12 mul def /rubrikwidth MonacoI9 setfont (exit/ ) stringwidth pop def Monaco9 setfont exitLineArray { stringwidth pop dup rubrikwidth add 16 add exitLineWidth gt { /exitLineWidth exch def }{ pop } ifelse } forall } if % % Get all the event/ lines and store each event in the eventsArray % Each element of the eventsArray is another array where the first % item holds the number of lines (following items) % /noOfEvents exch def /eventHeight 0 def noOfEvents 0 ne { /eventsArray noOfEvents array def /eventIndex 0 def { eventIndex noOfEvents eq { exit } if /noOfEventLines exch def /eventArray noOfEventLines 2 add array def eventArray 0 noOfEventLines put /lineIndex 1 def { lineIndex noOfEventLines 2 add eq { exit } if eventArray lineIndex 3 -1 roll put /lineIndex lineIndex 1 add def } loop eventsArray eventIndex eventArray put /eventIndex eventIndex 1 add def } loop /eventLineWidth 0 def eventsArray { /ar exch def /noOfLines ar 0 get def /eventHeight eventHeight noOfLines add def /rubrikwidth ar noOfLines 1 add get MonacoI9 setfont stringwidth pop def Monaco9 setfont /item noOfLines def { item 0 eq { exit } if ar item get Monaco9 setfont stringwidth pop rubrikwidth add 16 add dup boxwidth gt { /boxwidth exch def }{ pop } ifelse /item item 1 sub def } loop } forall /eventHeight eventHeight 10 mul def } if currentpoint /ulcy exch def /ulcx exch def /leftmargin currentpoint pop def /topmargin currentpoint exch pop def Monaco10 setfont name stringwidth pop dup 8 add boxwidth gt { /boxwidth exch def }{ pop } ifelse entryLineWidth boxwidth gt { /boxwidth entryLineWidth def } if doLineWidth boxwidth gt { /boxwidth doLineWidth def } if exitLineWidth boxwidth gt { /boxwidth exitLineWidth def } if 30 exitHeight add doHeight add entryHeight add eventHeight add dup boxheight gt { /boxheight exch def }{ pop } ifelse % Draw the name of the state Monaco10 setfont ulcx ulcy boxwidth boxheight drawRoundedBox ulcx boxwidth name stringwidth pop sub 2 div add ulcy 18 sub moveto name show /entryIndex 0 def entryHeight 0 ne { /item noOfEntryLines 1 sub def { item -1 eq { exit }if entryLineArray item get /item item 1 sub def ulcx 5 add ulcy 30 sub entryIndex 10 mul sub moveto entryIndex 0 eq { MonacoI9 setfont (entry/ ) show /leftmargin currentpoint pop ulcx 5 add sub def Monaco9 setfont } { leftmargin 0 rmoveto } ifelse show /entryIndex entryIndex 1 add def } loop } if Monaco9 setfont /doIndex 0 def doHeight 0 ne { /item noOfDoLines 1 sub def { item -1 eq { exit }if doLineArray item get /item item 1 sub def ulcx 5 add ulcy 30 sub doIndex 10 mul sub entryIndex 10 mul sub moveto doIndex 0 eq { (do: ) show /leftmargin currentpoint pop ulcx 5 add sub def }{ leftmargin 0 rmoveto } ifelse show /doIndex doIndex 1 add def } loop } if /eventIndex 0 def eventHeight 0 ne { /item noOfEvents 1 sub def { item -1 eq { exit }if /ar eventsArray item get def /item item 1 sub def /noOfLines ar 0 get def /lineIndex noOfLines 1 add def { lineIndex 0 eq { exit } if ar lineIndex get ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub moveto lineIndex noOfLines 1 add eq { MonacoI9 setfont show ( ) show /leftmargin currentpoint pop ulcx 5 add sub def ar noOfLines get Monaco9 setfont show /lineIndex lineIndex 2 sub def } { leftmargin 0 rmoveto show /lineIndex lineIndex 1 sub def }ifelse /eventIndex eventIndex 1 add def } loop } loop } if /exitIndex 0 def exitHeight 0 ne { /item noOfExitLines 1 sub def { item -1 eq { exit }if exitLineArray item get /item item 1 sub def ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub exitIndex 10 mul sub moveto exitIndex 0 eq { MonacoI9 setfont (exit/ ) show /leftmargin currentpoint pop ulcx 5 add sub def Monaco9 setfont } { leftmargin 0 rmoveto }ifelse show /exitIndex exitIndex 1 add def } loop } if leftmargin boxwidth add topmargin boxheight sub end } def /drawStateEvent % [ pointn ... point1 ] noOfPoints eventtext { 50 dict begin Monaco9 setfont /eventtext exch def /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def { index noOfPoints 2 mul eq { exit } if pntArray index 3 -1 roll put /index index 1 add def } loop newpath 1 setlinewidth 0 setgray /index 0 def { index noOfPoints eq { exit } if pntArray index 2 mul 1 add get pntArray index 2 mul get index 0 eq { moveto }{ lineto } ifelse /index index 1 add def } loop stroke pntArray noOfPoints 1 sub 2 mul 1 add get pntArray noOfPoints 1 sub 2 mul get pntArray noOfPoints 2 sub 2 mul 1 add get pntArray noOfPoints 2 sub 2 mul get % % Last line's x and y are on top of the stack % /p1.v exch def /p1.h exch def /p2.v exch def /p2.h exch def /width eventtext stringwidth pop def p1.v p2.v eq { /p.v p1.v 7 add def p1.h p2.h lt { /p.h p1.h p2.h p1.h sub 2 div add width 2 div sub def } { /p.h p2.h p1.h p2.h sub 2 div add width 2 div sub def }ifelse } { p1.h p2.h eq { /p.h p1.h 5 add def p1.v p2.v ge { /p.v p1.v p2.v p1.v sub 2 div add def } { /p.v p2.v p1.v p2.v sub 2 div add def }ifelse } { p1.v p2.v ge { /p.v p1.v p2.v p1.v sub 2 div add def } { /p.v p2.v p1.v p2.v sub 2 div add def }ifelse p1.h p2.h lt { /p.h p1.h p2.h p1.h sub 2 div width 2 div sub add def } { /p.h p2.h p1.h p2.h sub 2 div width 2 div sub add def }ifelse }ifelse }ifelse MonacoI9 setfont p.h p.v moveto eventtext show pntArray 1 get pntArray 0 get /p1.v exch def /p1.h exch def pntArray 3 get pntArray 2 get /p2.v exch def /p2.h exch def p1.h p2.h eq { p1.v p2.v gt { /p1.v p1.v 5 sub def } { /p1.v p1.v 5 add def }ifelse } { p1.h p2.h gt { /p1.h p1.h 5 sub def } { /p1.h p1.h 5 add def }ifelse } ifelse p2.h p2.v p1.h p1.v 1 5 5 false true drawArrow end } def /drawNote % linen line1 noOfLines width height drawNote { 50 dict begin /boxheight exch def /boxwidth exch def % % Get all the lines and store them in lineArray % Monaco9 setfont /noOfLines exch def noOfLines 0 ne { /lineArray noOfLines array def /lineIndex 0 def { lineIndex noOfLines eq { exit } if lineArray lineIndex 3 -1 roll put /lineIndex lineIndex 1 add def } loop } if currentpoint /ulcy exch def /ulcx exch def % compute max width of text lines /maxwidth 0 def noOfLines 0 ne { /item noOfLines 1 sub def { item -1 eq { exit }if lineArray item get stringwidth pop /width exch def maxwidth width lt { /maxwidth width def }if /item item 1 sub def } loop } if boxwidth maxwidth lt { /boxwidth maxwidth def }if % draw the box currentpoint boxwidth 0 rlineto 0 boxheight neg rlineto boxwidth neg 0 rlineto closepath stroke % set clipping region gsave newpath ulcx 5 add ulcy moveto boxwidth 10 sub 0 rlineto 0 boxheight neg rlineto boxwidth 10 sub neg 0 rlineto closepath clip /index 0 def noOfLines 0 ne { /item noOfLines 1 sub def { item -1 eq { exit }if lineArray item get /item item 1 sub def ulcx 5 add ulcy 12 sub index 10 mul sub moveto show /index index 1 add def } loop } if grestore newpath ulcx boxwidth add 14 sub ulcy moveto 14 0 rlineto 0 -10 rlineto closepath gsave stroke grestore 0.5 setgray fill 2 setlinejoin ulcx boxwidth add 14 sub ulcy moveto ulcx boxwidth add 12 sub ulcy 3 sub % x1, y1 ulcx boxwidth add 11 sub ulcy 5 sub % x2, y2 ulcx boxwidth add 12 sub ulcy 10 sub % x3, y3 curveto ulcx boxwidth add 9 sub ulcy 8 sub % x1, y1 ulcx boxwidth add 4 sub ulcy 8 sub % x2, y2 ulcx boxwidth add ulcy 10 sub % x3, y3 curveto closepath gsave 1 setgray fill grestore 0 setgray stroke 0 setlinejoin ulcx boxwidth add ulcy boxheight sub end } def /drawInitialState % diameter x y drawInitialState { 50 dict begin /y exch def /x exch def /circleSize exch def newpath x circleSize 2 div add y circleSize 2 div sub circleSize 2 div 0 360 arc closepath gsave stroke grestore fill end } def /drawFinalState % diameter x y drawFinalState { 50 dict begin /y exch def /x exch def /circleSize exch def newpath x circleSize 2 div add y circleSize 2 div sub circleSize 2 div 0 360 arc closepath stroke newpath x circleSize 2 div add y circleSize 2 div sub circleSize 2 div 3 sub 0 360 arc closepath fill end } def newpath 1 setlinewidth